<include file="Public/header"/>
<div class="ibox-content">
    <div class="deal-bd order-bottom">二维码管理</div>
    <form class="layui-form" action=""  method="get" autocomplete="off">
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input style="width:200px;" type="text" class="layui-input" name="money" id="money" placeholder="金额" lay-key="1" value="<{$_GET['money']}>">
            </div>
        </div>

        <div class="layui-inline">
            <div class="layui-input-inline">
                <input style="width:200px;" type="text" class="layui-input" name="create_time" id="createtime" placeholder="起始时间" value="" lay-key="1">
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline" style="width:200px;">
                <select name="status">
                    <option value="">状态</option>
                    <option value="0">开启</option>
                    <option value="1">关闭</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <button type="submit" class="layui-btn layui-bg-blue"><i class="fa fa-search"></i> 搜索</button>
            <button type="button" class="layui-btn layui-bg-blue add-btn" onclick="code_add('添加二维码','<{:U('Qrcode/addCode')}>',540,320)"><i class="fa fa-user"></i> 添加二维码</button>
        </div>
    </form>
</div>
<!--条件筛选过滤-->
<div class="tablediv">
    <table class="table table-hover choosetable">
        <thead>
        <tr>
            <th>ID</th>
            <th>金额</th>
            <th>支付URL</th>
            <th>创建时间</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <volist name="list" id="vo">
            <tr>
                <td><{$vo.id}></td>
                <td><{$vo.money}></td>
                <td><{$vo.url}></td>
                <td><{$vo.create_time|date="Y-m-d H:i:s",###}></td>
                <td>
                    <switch name="vo[status]" >
                        <case value="0">启用</case>
                        <case value="1">禁用</case>
                        <default />
                    </switch>
                </td>
                <td>
                    <button  class="btn btn-primary check-btn" onclick="code_edit('编辑','<{:U('Qrcode/addCode',['id'=>$vo[id]])}>',540,320)">查看</button>
                    <button  class="btn btn-primary" onclick="code_del(this,'<{$vo.id}>')">删除</button>
                </td>
            </tr>
        </volist>
        </tbody>
    </table>
    <div class="page"><{$page}></div>
</div>

<include file="Public/footer"/>
<script>
    layui.use(['form', 'layedit', 'laydate','layer'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate;
        //日期时间选择器
        laydate.render({
            elem: '#createtime'
            , type: 'datetime'
            ,theme: 'molv'
            , range: '|'
        });
        //常规用法
        laydate.render({
            elem: '#birthday'
        });
    });

    function code_edit(title, url, w, h) {
        x_admin_show(title, url, w, h);
    }

    function code_add(title, url, w, h) {
        x_admin_show(title, url, w, h);
    }

    /*二维码删除*/
    function code_del(obj, id) {
        layer.confirm('确认要删除吗？', function (index) {
            $.ajax({
                url:"<{:U('Qrcode/delCode')}>",
                type:'post',
                data:'id='+id,
                success:function(res){
                    if(res.status){
                        $(obj).parents("tr").remove();
                        layer.msg('已删除!',{icon:1,time:1000});
                    }
                }
            });
        });
    }

</script>
</body>
</html>
